<template>
  <view>
    <my-layout ref="my-layout" :tabbar-is-show="false" :is-absolute-body="true">
      <template #Navbar>
        <view
          style="width: 100%; height: 100%; display: flex; align-items: center"
        >
          <image
            @click="goback()"
            :src="indexTabBarUrl.navigateBack"
            style="width: 30rpx; height: 30rpx; margin-left: 40rpx"
          />
        </view>
      </template>
      <template #Body>
        <view class="pf_name_top">
          <view class="pf_card">
            <view class="dyname">
              <text>{{ performArr.name }}</text>
              <image
                src="http://llg.qiniu.comeinvip.com/images/pm_ico01.png"
              ></image>
            </view>
            <view class="dygroup">
              <image
                src="http://llg.qiniu.comeinvip.com/images/pfgroups.png"
              ></image>
            </view>
          </view>
          <image
            class="pf_name_bj"
            mode="aspectFill"
            :src="performArr.pictures[0]"
          ></image>
        </view>
        <!--底部波浪-->
        <image
          class="pf_setions_texture"
          src="http://llg.qiniu.comeinvip.com/images/pm_ico02.png"
        ></image>
        <!--信息-->
        <view class="pf_setions">
          <view class="fans_tit"
            ><text>演员简介</text>
            <view class="fans_line"></view>
          </view>
          <view class="pf_basic">
            <text>{{ performArr.introduce }}</text>
          </view>
          <view class="fans_tit"
            ><text>演员作品</text>
            <view class="fans_line"></view>
          </view>
          <scroll-view scroll-x="true" class="pf_works">
            <view
              class="pf_wk_ans"
              v-for="(pitem, pkey) in performerWorks"
              :key="pkey"
            >
              <view class="wk_ans_style">
                <image mode="aspectFill" :src="pitem.cover[0]"></image>
                <text>{{ pitem.name }}</text>
              </view>
            </view>
          </scroll-view>
          <view class="fans_tit"
            ><text>演出排期</text>
            <view class="fans_line"></view>
          </view>
          <view class="pf_scheduling">
            <view
              class="scheduling_ans"
              v-for="(titem, tkey) in performerTime"
              :key="tkey"
            >
              <text class="scd_round"></text>
              <view class="scd_info">
                <text class="scd_style01">{{ titem.name }}</text>
                <text class="scd_style02">{{ titem.address }}</text>
                <text class="scd_style03">{{ titem.show_time }}</text>
              </view>
            </view>
          </view>
        </view>
      </template>
    </my-layout>
  </view>
</template>

<script>
// import performerbj from "@/static/images/pm_ico02.png"
import configApi from "@/utils/config.js";
import indexTabBarUrl from "@/url/index_tabBar";
export default {
  data() {
    return {
      indexTabBarUrl,
      videoHeight: 500,
      // performerbj: performerbj,
      navHeight: uni.getSystemInfoSync()["statusBarHeight"],
      getIds: null,
      performArr: {}, //基本信息
      performerWorks: [], //演员作品
      performerTime: [], //排期
    };
  },
  methods: {
    goback() {
      uni.navigateBack();
    },
  },
  async onLoad(options) {
    let vdHeight = uni.getSystemInfoSync().windowHeight;
    this.videoHeight = vdHeight;

    try {
      this.$refs["my-layout"].openLoading();
      if (options.id) {
        this.getIds = options.id;
      }
      //获取演员详情
      let pinfo = {
        performer_id: this.getIds,
      };
      let performArr = await configApi.PerformerDetails(pinfo);
      performArr.pictures = JSON.parse(performArr.pictures).map(
        (item) => item.url
      );
      this.performArr = performArr;
      let performerWorks = await configApi.PerformerWorks(pinfo);
      this._.forEach(performerWorks, (item) => {
        item.cover = JSON.parse(item.cover).map((item) => item.url);
      });
      this.performerWorks = performerWorks;
      this.performerTime = await configApi.PerformerTime(pinfo);
      this.$refs["my-layout"].closeLoading();
    } catch (error) {
      this.$refs["my-layout"].closeLoading();
      wx.showToast({
        title: "网络异常",
        icon: "error",
        mask: true,
      });
    }
  },
};
</script>

<style>
@import url("@/static/css/member.css");
@import url("@/static/css/performer.css");
</style>
